package me.spring.cloud.common.components.rabbitmq.message;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description: rabbitmq延迟重试消息体
 * @author: luffy
 * @create: 2019-01-18 13:47
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DLXMessage<M extends IMessage> implements RetryMessage {

  private static final long serialVersionUID = -7811347791620792453L;

  private M content;

  /** 最大重试次数-默认不限制次数 */
  private int maxAttempts = 0;

  /** 最大重试时间间隔(秒) */
  private int maxInterval = 3600;

  /** 最小重试时间间隔(秒) */
  private int minInterval = 1;

  /** 每次递增倍数 */
  private int multiple = 1;

  /** 已重试次数 */
  private int retryNum = 0;

  @Override
  public void countRetryNum() {
      this.retryNum = this.retryNum + 1;
  }
}
